package com.bdsy.business.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.business.dao.ShopTrailMapper;
import com.bdsy.business.model.ShopTrail;
import com.bdsy.business.service.ShopTrailService;
import com.bdsy.common.utils.DateUtil;
import com.bdsy.common.utils.DateUtils;

@Service("shopTrailService")
public class ShopTrailServiceImpl implements ShopTrailService {

	@Autowired
	ShopTrailMapper shopTrailMapper;
	
	@Override
	public List<ShopTrail> selectShopTrailById(int shopId) {
		List<ShopTrail> shopTrail = shopTrailMapper.selectShopTrailById(shopId);
		return shopTrail;
	}

	@Override
	public boolean add(ShopTrail shopTrail) {
		int number = (int)((Math.random()*9+1)*10000000);
		shopTrail.setId(number);
		shopTrail.setTrailTime(DateUtil.getCurrentDate());
		int result = shopTrailMapper.insert(shopTrail);
		return result>0?true:false;
	}

}
